package com.touna.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * author: xl
 * time: 2018/3/2 11:28
 * description:
 **/
@Controller
public class LogController {
    // 获取log4j2.xml文件中定义的名为“MainLogger”的Logger
    // 如果没有对应名称的Logger，则无法使用Logger记录和输出日志信息
    protected Logger logger = LoggerFactory.getLogger(getClass());

    @RequestMapping(value = "/test1")
    @ResponseBody
    public String test1(){
        logger.info("Hello Wo:{},test:{}",100,200);
        logger.error("Hello Wo");
        logger.debug("Hello Wo");
        logger.warn("Hello Wo");
        return "test";
    }
}
